package com.ruoyi.partybuilding.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.partybuilding.common.EQueryController;
import com.ruoyi.partybuilding.common.PageSort;
import com.ruoyi.partybuilding.common.TableDataInfoRows;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.partybuilding.domain.NewsType;
import com.ruoyi.partybuilding.service.INewsTypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.*;
/**
 * 新闻栏目Controller
 * 
 * @author he-liangliang@outlook.com
 * @date 2024-11-27
 */
@Api(tags = "新闻栏目")
@RestController
@RequestMapping("/partybuilding/NewsType")
public class NewsTypeController extends EQueryController<NewsType>
{
    @Autowired
    private INewsTypeService newsTypeService;

    /**
     * 查询新闻栏目列表
     */
    @Anonymous
    @ApiOperation("列表")
//    @PreAuthorize("@ss.hasPermi('partybuilding:NewsType:list')")
    @GetMapping("/list")
    public TableDataInfoRows<NewsType> list(NewsType newsType, PageSort page) {
        return super.list(newsType, page);
    }


    /**
     * 导出新闻栏目列表
     */
    @ApiOperation("导出")
    @PreAuthorize("@ss.hasPermi('partybuilding:NewsType:export')")
    @Log(title = "新闻栏目", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(NewsType newsType,PageDomain pageRequest,HttpServletResponse response)
    {
       super.export(newsType,pageRequest,"新闻栏目数据",response);
    }

    /**
     * 获取新闻栏目详细信息
     */
    @ApiOperation("详情")
    @PreAuthorize("@ss.hasPermi('partybuilding:NewsType:query')")
    @GetMapping(value = "/{id}")
    public R<NewsType> getInfo(@PathVariable("id") Long id)
    {
        return super.getInfo(id);
    }

    /**
     * 新增新闻栏目
     */
    @ApiOperation("新增")
    @PreAuthorize("@ss.hasPermi('partybuilding:NewsType:add')")
    @Log(title = "新闻栏目", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public R<Long> add(@RequestBody NewsType newsType)
    {
        return super.add(newsType);
    }

    /**
     * 修改新闻栏目
     */
    @ApiOperation("编辑")
    @PreAuthorize("@ss.hasPermi('partybuilding:NewsType:edit')")
    @Log(title = "新闻栏目", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public R<Long> edit(@RequestBody NewsType newsType)
    {
        return super.edit(newsType);
    }

    /**
     * 删除新闻栏目
     */
    @ApiOperation("删除")
    @PreAuthorize("@ss.hasPermi('partybuilding:NewsType:remove')")
    @Log(title = "新闻栏目", businessType = BusinessType.DELETE)
	@PostMapping("remove/{ids}")
    public R<Long> remove(@PathVariable Long[] ids)
    {
        return super.remove(ids);
    }
}
